
package Bank;


import java.util.ArrayList;

public class TaskManager {

    private ArrayList<String> highPriority;
    private ArrayList<String> lowPriority; 

    public TaskManager() {

        this. highPriority = new ArrayList<String>();
        this.lowPriority = new ArrayList<String>();

    }


    public void addTask(String task) {
        if (task.contains("*")){
            highPriority.add(task);
        } else {
            lowPriority.add(task);
        }
        
    }


    public void removeTask(String priority, int index) {
        if(priority.equals("high")){
            highPriority.remove(index);
        } else if (priority.equals("low")){
            lowPriority.remove(index);
        }
    }


    public void changePriority(String priority, int index) {
        if(priority.equals("high")){
            lowPriority.add(highPriority.get(index));
            highPriority.remove(index);
        } else if (priority.equals("low")){
            highPriority.add(lowPriority.get(index));
            lowPriority.remove(index);
        }
    }

    public void promoteTask(int index) {
         if (index > 0) {
            String temp = highPriority.get(index);
            highPriority.set(index, highPriority.get(index - 1));
            highPriority.set(index - 1, temp);
        }
    }
    

    public ArrayList<String> getHighPriorityTasks() {
        return new ArrayList<>(highPriority);
    }


    public ArrayList<String> getLowPriorityTasks() {
        return new ArrayList<>(lowPriority);
    }


    public void displayTasks() {
        System.out.println("\nHigh Priority Tasks:");
        for (int i = 0; i < highPriority.size(); i++) {
            System.out.println(i + ". " + highPriority.get(i));
        }

        System.out.println("\nLow Priority Tasks:");
        for (int i = 0; i < lowPriority.size(); i++) {
            System.out.println(i + ". " + lowPriority.get(i));
        }
    }
}
